package base.thread_JUC2.chapter01.demo011;

public class MyThreadGroup extends ThreadGroup{

    public MyThreadGroup(String name) {
        super(name);
    }

    @Override
    public void uncaughtException(Thread t, Throwable e) {
//        super.uncaughtException(t, e);
        System.out.printf("线程 %s 抛出一个异常\n", t.getId());
        e.printStackTrace();
        System.out.println(Thread.currentThread().getId()+" 号线程开始终止线程组中其余线程，存活线程数："+this.activeCount());
        interrupt();
    }
}
